package com.tudouji.project.mt.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.mt.domain.MtWhoutitem;
import com.tudouji.project.mt.service.IMtWhoutitemService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 美团出库明细Controller
 * 
 * @author tudouji
 * @date 2023-11-21
 */
@RestController
@RequestMapping("/mt/whoutitem")
public class MtWhoutitemController extends BaseController
{
    @Autowired
    private IMtWhoutitemService mtWhoutitemService;

    /**
     * 查询美团出库明细列表
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:list')")
    @GetMapping("/list")
    public TableDataInfo list(MtWhoutitem mtWhoutitem)
    {
        startPage();
        List<MtWhoutitem> list = mtWhoutitemService.selectMtWhoutitemList(mtWhoutitem);
        return getDataTable(list);
    }

    /**
     * 导出美团出库明细列表
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:export')")
    @Log(title = "美团出库明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MtWhoutitem mtWhoutitem)
    {
        List<MtWhoutitem> list = mtWhoutitemService.selectMtWhoutitemList(mtWhoutitem);
        ExcelUtil<MtWhoutitem> util = new ExcelUtil<MtWhoutitem>(MtWhoutitem.class);
        return util.exportExcel(list, "whoutitem");
    }

    /**
     * 获取美团出库明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(mtWhoutitemService.selectMtWhoutitemById(id));
    }

    /**
     * 新增美团出库明细
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:add')")
    @Log(title = "美团出库明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MtWhoutitem mtWhoutitem)
    {
        return toAjax(mtWhoutitemService.insertMtWhoutitem(mtWhoutitem));
    }

    /**
     * 修改美团出库明细
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:edit')")
    @Log(title = "美团出库明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MtWhoutitem mtWhoutitem)
    {
        return toAjax(mtWhoutitemService.updateMtWhoutitem(mtWhoutitem));
    }

    /**
     * 删除美团出库明细
     */
    @PreAuthorize("@ss.hasPermi('mt:whoutitem:remove')")
    @Log(title = "美团出库明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mtWhoutitemService.deleteMtWhoutitemByIds(ids));
    }
}
